<template>
  <el-main>
   <iframe :src="url" frameborder="0" width="100%" :style="{height:calHeight}" scrolling="auto"></iframe>
  </el-main>
</template>
<script>
export default {
  data() {
    return {
      url: 'http://192.168.3.122:9528?token=' + this.$store.getters.token
    }
  },
    mounted () {
    const iframe = document.getElementById('modle_iframe')
    const baseUrl = `http://192.168.3.122:9528/#/home`
    this.url = `${baseUrl}?token=${this.$store.getters.token}`
    const obj = {
      sign: 'safeDaba',
      value: '9'
    }
    const msg = JSON.stringify(obj)
    iframe.contentWindow.postMessage(msg, '*')
    this.$nextTick(() => {
        this.init()
      })
  },
  computed: {
    //计算属性 , 设置iframe高度为窗口高度少140px
    calHeight() {
      return (window.innerHeight - 140) + 'px';
    },
  },
}
</script>
<style lang='scss' scoped>
  iframe {
    width: 100%;
    overflow-x: hidden;
  }
</style>
